package cn.powertime.evaluation.facade.impl;

import cn.powertime.evaluation.annotation.Facade;
import cn.powertime.evaluation.entity.ZcPolicy;
import cn.powertime.evaluation.facade.ZcPolicyFacade;
import cn.powertime.evaluation.service.ZcPolicyService;
import cn.powertime.evaluation.vo.PageVo;
import cn.powertime.evaluation.vo.ZcRespListVo;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

@Facade
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED, isolation = Isolation.READ_COMMITTED)
public class ZcPolicyFacadeImpl implements ZcPolicyFacade {

    @Autowired
    private ZcPolicyService zcPolicyService;

    @Override
    public IPage<ZcRespListVo> list(PageVo pageVo) {
        Page<ZcPolicy> page = new Page<>(pageVo.getCurrent(), pageVo.getSize());
        return zcPolicyService.list(page);
    }

    @Override
    public ZcPolicy selectById(Long id) {
        return zcPolicyService.getById(id);
    }
}
